Xbasic

usps_city_from_zip Function

Syntax

City as C = usps_city_from_zip(C zip5 )

Arguments

City

The name of the city containing the specified ZIP code.

zip5

A 5 or 9 digit ZIP code. The function truncates 9 digit codes to 5 digits.

Description

Contacts the USPS web site and looks up the city for the specified 5 digit zip code.

Discussion

The USPS_City_From_ZIP() function contacts the USPS web site and looks up the city containing the specified ZIP code. It the returns the city that contains the specified ZIP code. Note : Use of this function requires an active Internet connection. ZIP codes are used by the US Postal Service (USPS) for addressing mail in the United States.

Example

? usps_city_from_zip("01803") 
= "BURLINGTON"
? usps_city_from_zip("12345") 
= "SCHENECTADY"